/**
 * Created by dmrj on 2016/5/3.
 */
define(['jquery', 'jquery-form/jquery-form.min', 'jquery-validate/jquery.validate.min'], function ($) {
    return {

        positiveInt: function () {
            $.validator.addMethod("positiveinteger", function (value, element) {
                var aint = parseInt(value);
                return aint > 0 && (aint + "") == value;
            }, $.i18n.prop("MESSAGE_VALIDATE_POSITIVE"));

        },

        excellentRuleCheck: function () {
            $.validator.addMethod("excellentRule", function (value, element, param) {
                var thisValue = parseInt(value);
                var afterValue = parseInt(param);
                return thisValue < afterValue && (thisValue + "") == value;
            }, $.i18n.prop("VALIDATE_CCW_LTE_NEXT"));
        },

        betweenRuleCheck: function () {
            $.validator.addMethod("betweenRule", function (value, element, param) {
                var thisValue = parseInt(value);
                var beforeValue = parseInt(param.beforeValue);
                var afterValue = parseInt(param.afterValue);
                return thisValue > beforeValue && thisValue < afterValue && (thisValue + "") == value;
            }, $.i18n.prop("VALIDATE_GRRSETTING_LTE_NEXT_GTE_PREVIOUS"));
        },

        marginalRuleCheck: function () {
            $.validator.addMethod("marginalRule", function (value, element, param) {
                var thisValue = parseInt(value);
                var beforeValue = parseInt(param);
                return thisValue > beforeValue > 0 && (thisValue + "") == value;
            }, $.i18n.prop("VALIDATE_CCW_GTE_PREVIOUS"));
        }
    };
});